#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
using namespace std;

void func1()
{
    int n = 0;
    cin >> n;
    int a[1000000];
    a[0] = 1;
    a[1] = 2;
    for (int i = 2; i < 1000000; ++i)
        a[i] = (2 * a[i - 1] + a[i - 2]) % 32767;
    int x;
    while (n--)
    {
        cin >> x;
        cout << a[x - 1] << endl;
    }
}

void func2()
{
    string s;
    getline(cin, s, '\n');
    int eng = 0, spc = 0, num = 0, oth = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i] >= 48 && s[i] <= 57)
            ++num;
        else if (s[i] == 32)
            ++spc;
        else if ((s[i] >= 65 && s[i] <= 90) || s[i] >= 97 && s[i] <= 122)
            ++eng;
        else
            ++oth;
    }
    printf("%d\n", eng);
    printf("%d\n", spc);
    printf("%d\n", num);
    printf("%d\n", oth);
}

int longestOnes(vector<int>& nums, int k) {
    int zero = 0, len = 0;
    for (int left = 0, right = 0; right < nums.size(); ++right)
    {
        if (nums[right] == 0) ++zero;
        while (zero > k)
        {
            if (nums[left++] == 0) --zero;
        }
        len = max(len, right - left + 1);
    }
    return len;
}

int minOperations(vector<int>& nums, int x) {
    int sum = 0;
    for (auto e : nums)
    {
        sum += e;
    }
    int n = nums.size();
    int target = sum - x;
    if (target < 0) return -1;
    int ml = 0;
    for (int left = 0, right = 0, mov = 0; right < n; ++right)
    {
        mov += nums[right];
        while (left<right && mov>target)
            mov -= nums[left++];
        if (mov == target)
            ml = max(ml, right - left + 1);
    }
    return ml == 0 && target != 0 ? -1 : n - ml;
}